<?php
/**
 *
 * @author henry
 * @version
 */
require_once 'Zend/View/Interface.php';

/**
 * ServicesListSelect helper
 *
 * @uses viewHelper Zend_View_Helper
 */
class Zend_View_Helper_ServicesListSelect
{

	/**
	 * @var Zend_View_Interface
	 */
	public $view;

	/**
	 *
	 */
	public function servicesListSelect($name,$serviceId = -1,$css = null) 
	{
		$ObService = new Default_Model_Services();
		$data = $ObService->getIdAndName();
		if (empty($data))
		{
			return "No services";			
		}
		$str = "<select id='$name' name='$name' style='$css'>
			        	<option value='-1'>[Choose ...]</option>
		";
		foreach($data as $item)
		{
			$strTmp = $item->services_id==$serviceId?"selected='selected'":"";
			$str.= "<option $strTmp value='$item->services_id'>$item->services_name</option>";
		}
		$str .= "</select>";
		return $str;
	}

	/**
	 * Sets the view field
	 * @param $view Zend_View_Interface
	 */
	public function setView(Zend_View_Interface $view) {
		$this->view = $view;
	}
}
